package by.dvrudenko.avtobaza.services;

import java.sql.Timestamp;
import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.dvrudenko.avtobaza.dataaccess.en.Restriction;
import by.dvrudenko.avtobaza.datamodel.Car;
import by.dvrudenko.avtobaza.datamodel.UserOrder;
import by.dvrudenko.avtobaza.datamodel.enums.OrderStatus;

public interface UserOrderService {
	
	Long getCount(Long UserId);
	
	UserOrder get(Long id);
	
	@Transactional
	void saveOrUpdate(UserOrder userOrder);

	@Transactional
	void delete(UserOrder userOrder);

	@Transactional
	void deleteAll();
	
	@Transactional	
	void changeOrderStatus(Long id,OrderStatus orderStatus);
	
	List <UserOrder> getAllOrderByUserId(Long id);
	
	List<UserOrder> getAllOrderByStatus(OrderStatus orderStatus);
	
	List<UserOrder> getAllOrderByDate(Timestamp year , Restriction condition);
	
	UserOrder getRandomOrder();
	
    List<UserOrder> getAllUserOrder(SingularAttribute<UserOrder, ?> attr, boolean ascending, 
    		int startRecord, int pageSize, Long UserId);
}
